// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2005-1-4

#ifndef __DBMSG_MAINHANDLER_H_SERVER_SVR_MAIN__
#define __DBMSG_MAINHANDLER_H_SERVER_SVR_MAIN__

#pragma once

#include <common/svr_base/dbmsg_defaulthandler.h>
#include "msvr_room.h"

namespace JoyServer
{

class CJoyDbMsgMainHandler : public CJoyDbMsgDefaultHandler
{
public:
    virtual void OnDbMsg_RoomNote(const CJoyDbMsg& msg);
    virtual void OnDbMsg_RoomLoad(const CJoyDbMsg& msg);
    virtual void OnDbMsg_RoomShutdown(const CJoyDbMsg& msg);
public:
    CJoyDbMsgMainHandler();
    virtual ~CJoyDbMsgMainHandler();

    virtual bool Create(CJoyServer* pServer);
    virtual void Destroy();

    CJoyMainServer* GetServer()
    {
        return (CJoyMainServer*)m_server;
    }

    // asynchronous call, used for administrator.
    virtual void KickUser(UINT userId, UINT err, UINT serverId = 0, UINT tempId = 0);

    virtual void BanUser(CJoyMainUser* pAdmin, CJoyMainUser* pUser, int days, int hours, int minutes, int seconds);
    virtual void BanUserByNick(CJoyMainUser* pAdmin, const CString& nickname, int days, int hours, int minutes, int seconds);
    virtual void BanUserByName(CJoyMainUser* pAdmin, const CString& username, int days, int hours, int minutes, int seconds);
};


} // namespace JoyServer

#endif  // __DBMSG_MAINHANDLER_H_SERVER_SVR_MAIN__